<?php

namespace app\admin\model;

use think\Model;


class Analyze extends Model
{

    

    

    // 表名
    protected $name = 'analyze';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'k_type_text',
        'mall_type_text'
    ];
    

    
    public function getKTypeList()
    {
        return ['0' => __('K_type 0'), '1' => __('K_type 1'), '2' => __('K_type 2'), '3' => __('K_type 3')];
    }

    public function getMallTypeList()
    {
        return ['1' => __('Mall_type 1'), '2' => __('Mall_type 2')];
    }


    public function getKTypeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['k_type']) ? $data['k_type'] : '');
        $list = $this->getKTypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getMallTypeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['mall_type']) ? $data['mall_type'] : '');
        $list = $this->getMallTypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
